<?php

class UserTemp {
	
	/**
	 * @var string
	 */
	private $username;
	private $passwordTemp;
	private $passwordEncrypted;
	
	/**
	 * @var integer
	 */
	private $expireDate;
	
	/**
	 * @param string $username
	 * @param string $password
	 * @param boolean $usingTempPassword
	 */
	public function __construct($username, $password, $usingTempPassword) {
		$this->username = $username;
		
		// If using tempPassword, password is already encrypted.
		if ($usingTempPassword) {
			$parts = explode("<>", $password);
			$this->passwordEncrypted = $parts[0];
			$this->expireDate = $parts[1];
		}
		else {
			// If not using tempPassword, password gets encrypted.
			$this->passwordEncrypted = sha1($password);
		}
	}
	
	/**
	 * @return string
	 */
	public function getUsername() {
		return $this->username;
	}
	
	/**
	 * @return string
	 */
	public function getPasswordEncrpyted() {
		return $this->passwordEncrypted;
	}
	
	/**
	 * @return integer
	 */
	public function getExpireDate() {
		return $this->expireDate + 0;
	}
}
